<?php
/**
 * Created by PhpStorm.
 * User: weijer
 * Date: 2018/10/26
 * Time: 21:17
 */

namespace common\validate;

use think\Validate;

class Options extends Validate
{
    //验证规则
    protected $rule = [];

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.options_name', 'require|max:128')
            ->append('data.type', 'require|max:128')
            ->append('data.config', 'array');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this
            ->append('data.options_name', 'require|max:128')
            ->append('data.type', 'max:128')
            ->append('data.config', 'array');
    }

    // GetNotifyTemplateId 验证场景定义
    public function sceneGetNotifyTemplateId()
    {
        return $this->append('item_name', 'require');
    }

    public function sceneGetOptionsItem()
    {
        return $this->append('options_name', 'require')
            ->append('options_item_name', 'require');
    }
}
